<template>
  <div id="poster">
    <img
      src="https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/img/h5Phone.png"
      alt=""
    />
    <img
      src="https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/img/h5Zsy.png"
      alt=""
    />
    <img
      src="https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/img/h5zhekou.png"
      alt=""
    />
    <img
      src="https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/icon/h5Btn.png"
      alt=""
      class="beVip"
      @click="toBuyVip"
      v-if="flag"
    />
  </div>
</template>

<script>
import req from "@/utils/index";
import { Toast } from "vant";
export default {
  data() {
    return {
      goodsNo: window.localStorage.getItem("VipGoodsNo"),
      flag: true,
    };
  },
  methods: {
    toBuyVip() {
      //   const userMsg = JSON.parse(window.localStorage.getItem("userMsg"));
      if (this.goodsNo == "") {
        Toast("网络错误");
        return;
      }
      if (window.localStorage.getItem("phone") == "") {
        this.$router.push({
          name: "getUser",
          query: {
            spid: window.localStorage.getItem('VipGoodsNo')
          }
        });
      } else {
            window.localStorage.setItem('whatBuy', 'vip')
        this.$router.push({
          name: "creatOrder",
          query: {
            goodsNo: this.goodsNo,
            didPay: "noYet",
            isGsq: false,
          },
        });
      }
    },
  },
  created() {
    if (this.$route.query.flag == 1) {
      this.flag = false;
    } else {
      this.flag = true;
    }
  },
};
</script>

<style scoped>
#poster {
  background-image: url(https://tsyx-rights-and-interests.oss-cn-hangzhou.aliyuncs.com/background/h5BG.png);
  background-size: 100%;
  background-repeat: no-repeat;
  background-color: #a31a0e;
  text-align: center;
  padding: 5rem 0 2rem 0;
}
img {
  width: 95%;
}
.beVip {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
</style>